/**
 * 
 */
package testy;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import poker.*;

/**
 * @author Administrator
 *
 */
public class TableTest {

	static Table testTable;
	static Human testPlayer1, testPlayer2;
	
	/**
	 * @throws java.lang.Exception
	 */
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		testTable = new Table(null);
		testPlayer1 = new Human(testTable);
		testPlayer2 = new Human(testTable);
	}

	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		//testTable.deal();
		testPlayer1.reset();
		testPlayer2.reset();
	}

	/**
	 * @throws java.lang.Exception
	 */
	@After
	public void tearDown() throws Exception {
	}

	/**
	 * Test method for {@link poker.Table#whoseTurn()}.
	 */
	@Test
	public void testWhoseTurn() {
		Player Players[] = testTable.getPlayers();
		assertEquals("Test turn",testTable.whoseTurn(),Players[testTable.getCurrentPlayer()]);
	}

	/**
	 * Test method for {@link poker.Table#endTurn(poker.Player)}.
	 */
	@Test
	public void testEndTurn() {
	}

	/**
	 * Test method for {@link poker.Table#sumUp()}.
	 * @throws PokerException 
	 */
	@Test
	public void testSumUp() throws PokerException {
		testPlayer1.addCards(new Card(0,8), new Card(0,12), new Card(0,3), new Card(0,2), new Card(0,10));
		testPlayer2.addCards(new Card(2,12), new Card(2,3), new Card(2,10), new Card(2,2), new Card(2,13));
		testTable.setup(testPlayer1,testPlayer2);

		testTable.sumUp();
		
		assertTrue("Should be tie",testTable.rank[0] > testTable.rank[1]);
	}

	/**
	 * Test method for {@link poker.Table#deal()}.
	 */
	@Test
	public void testDeal() {
	}

}
